#include "labelview.h"

#include <QWheelEvent>

LabelView::LabelView(QGraphicsScene *scene, QWidget *parent)
    : QGraphicsView(scene, parent)
{

}

void LabelView::wheelEvent(QWheelEvent *event)
{
    if (event->angleDelta().y() > 0)
        zoomIn();
    else
        zoomOut();
}

void LabelView::zoomIn()
{
    if (scaleFactor < 3.0) {
        scale(1.25, 1.25);
        scaleFactor *= 1.25;
    }
}

void LabelView::zoomOut()
{
    if (scaleFactor > 0.333) {
        scale(0.8, 0.8);
        scaleFactor *= 0.8;
    }
}
